// Copyright Epic Games, Inc. All Rights Reserved.

#include "VirtualBoneLibBPLibrary.h"
// Copyright (C) 2020 Wuguyannian - All Rights Reserved
#include "VirtualBoneLib.h"
#include "Animation/Skeleton.h"

DEFINE_LOG_CATEGORY_STATIC(LogVirtualBoneLib, Log, All);

UVirtualBoneLibBPLibrary::UVirtualBoneLibBPLibrary(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{

}

void UVirtualBoneLibBPLibrary::PrintVirtualBone(class USkeleton* Skeleton)
{
	if (Skeleton)
	{
		const int32 NumVirtualBones = Skeleton->GetVirtualBones().Num();
		if (NumVirtualBones > 0)
		{
			for (int32 VBIndex = 0; VBIndex < NumVirtualBones; ++VBIndex)
			{
				const FVirtualBone& Bone = Skeleton->GetVirtualBones()[VBIndex];
				UE_LOG(LogVirtualBoneLib, Display, TEXT("Virtual Bone [%s] SourceBone [%s] TargetBone [%s]"), 
					*Bone.VirtualBoneName.ToString(), *Bone.SourceBoneName.ToString(), *Bone.TargetBoneName.ToString());
			}
		}
		else
		{
			UE_LOG(LogVirtualBoneLib, Display, TEXT("Skeleton [%s] Has no Virtual Bone"), *Skeleton->GetName());
		}
	}
}
